<template>
  <div class="data-content">
    <div class="head-content">
      <div class="head-content_btn">
        <el-button class="btnDefault " type="info"  @click="saveXtcspz">保存</el-button>
      </div>
      <div class="head-content_now">
        <span>当前位置 :</span>
        <span>系统参数配置</span>
      </div>
    </div>
    <div class="table-content">
      <div class="role-list-div">
        <el-form ref="form" :model="form" :rules="rules" label-width="130px" class="noBg mt20">
          <el-form-item label="系统备份路径：" prop="path">
              <el-input v-model="form.path" class="border1 inputWidth"></el-input>
              <span class="bz">* 例：D:\备份\</span>
          </el-form-item>
          <el-form-item label="系统上传路径：" prop="upLoadPath">
              <el-input v-model="form.upLoadPath" class="border1 inputWidth"></el-input>
              <span class="bz">* 例：D:\上传\</span>
          </el-form-item>
          <el-form-item label="系统锁定时间：" prop="lockTime">
              <el-input v-model="form.lockTime" class="border1 inputWidth"></el-input>
              <span class="bz">分钟 *</span>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import {baseServe} from "../../request/api";

export default {
  name: "xtcspz",
  props: {
    msg: String
  },
  data() {
      return {
          rules:{
            path:[
              { validator: this.checkPath, trigger: ["change", "blur"] }
            ],
            upLoadPath:[
              { validator: this.checkPath, trigger: ["change", "blur"] }
            ],
            lockTime:[
              { validator: this.checkNum, trigger: ["change", "blur"] }
            ]
          },
          input: '',
          form:{
              path:'D:\\backup\\',
              upLoadPath:'D:\\人防多媒体\\',
              lockTime:'100'
          }
      }
  },
  mounted(){
    this.queryPath();
  },
  methods:{
      queryPath(){
        baseServe.getQueryPath().then(res => {
          // console.log(res,'res7845');
          if(res.data.result.resultCode=="000000"){
            this.form.path = res.data.path;
            this.form.upLoadPath = res.data.upLoadPath;
            this.form.lockTime = res.data.lockTime;
          }
        })
      },
      saveXtcspz(){
        let params = {
          newPath: this.form.path,
          newUpLoadPath: this.form.upLoadPath,
          newLockTime: this.form.lockTime
        }
        baseServe.getUpdataPath(params).then(res => {
          // console.log(res,'4654');
          if(res.data.result.resultCode=="000000"){
            this.$message({
              type: 'success',
              message: '保存成功'
            });
          }else{
            this.$message({
              type: 'error',
              message: '保存失败'
            });
          }
        });

      }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less">
  .data-content{
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    color: #ffffff;
    font-size: 14px;
    box-sizing: border-box;
    .head-content {
      display: flex;
      height: 7%;
      line-height: 2;
      justify-content: space-between;
      padding: 0 20px;
      color: #fff;
      box-sizing: border-box;
      .head-content_btn {
        width: 80%;
        margin-top: 10px;
      }
      .head-content_now {
        // width: 20%;
        margin-top: 20px;
      }
    }
    .table-content{
      overflow: auto;
      position: absolute;
      top: 35px;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 40px;
      border: 1px solid #00f0ff;
      border-top: 4px solid #00f0ff;
      margin: 20px;
      .inputWidth{
        width: 20%;
      }
      .bz{
        margin-left: 20px;
      }
    }
  }


</style>
